package com.huonan.jb.tools.kafka;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.stereotype.Component;

@Component
public class MyKafkaListener {

//    @KafkaListener(topics = "kktt", concurrency = "1")
//    public void listen(String message) {
//
//        System.out.println("Received message: " + message);
//    }

//    @KafkaListener(topics = "kktt", concurrency = "1")
    public void listen(ConsumerRecord<String, String> record) {
        System.out.println("进入topics方法");
        System.out.printf(
                "主题 = %s,分区 = %d, 偏移量 = %d, key = %s, 内容 = %s,创建消息的时间戳 =%d%n",
                record.topic(),
                record.partition(),
                record.offset(),
                record.key(),
                record.value(),
                record.timestamp()
        );
    }
}